package com.sc.nft.config.lianlian;

import com.qiniu.util.IOUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.security.KeyStore;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.util.Enumeration;

@Configuration
@Slf4j
public class LlInit {
    @Value("${pay.llConfig.apiUrl}")
    private String apiUrl;
    @Value("${pay.llConfig.pgwUrl}")
    private String pgwUrl;
    @Value("${pay.llConfig.fileUrl}")
    private String fileUrl;
    @Value("${pay.llConfig.llPublicKey}")
    private String llPublicKey;
    @Value("${pay.llConfig.publicKey}")
    private String publicKey;
    @Value("${pay.llConfig.privateKey}")
    private String privateKey;
    @Value("${pay.llConfig.merchant}")
    private String merchantNo;
    @Value("${pay.llConfig.platform}")
    private String platform;
    @Value("${pay.llConfig.openAccountNotifyUrl}")
    private String openAccountNotifyUrl;
    @Value("${pay.llConfig.paySuccessNotifyUrl}")
    private String paySuccessNotifyUrl;
    @Value("${pay.wallet.wallet_url}")
    private String openAccountReturnUrl;
    @Value("${pay.llConfig.anonymousBindCardNotify}")
    private String anonymousBindCardNotify;
    @Value("${pay.llConfig.unAnonymousBindCardNotify}")
    private String unAnonymousBindCardNotify;
    @Value("${pay.llConfig.bindCardNotify}")
    public  String bindCardNotify;
    @Value("${pay.llConfig.withdrawNotify}")
    public  String withdrawNotify;
    @Value("${pay.llConfig.daoWithdrawNotify}")
    public  String daoWithdrawNotify;
    @Value("${pay.llConfig.unBindCardNotify}")
    public  String unBindCardNotify;
    @Value("${pay.url.paySuccessReturnUrl}")
    public  String paySuccessReturnUrl;
    @Value("${pay.llConfig.modifyUserNotifyUrl}")
    public  String modifyUserNotifyUrl;
    @Value("${pay.llConfig.mall_ll_notify_url}")
    public  String mallLlNotifyUrl;
    @Value("${pay.llConfig.mall_ll_refund_notify_url}")
    public  String mallLlRefundNotifyUrl;
    @Value("${pay.llConfig.business_open_account_notify}")
    public  String businessOpenAccountNotifyUrl;

    @PostConstruct
    public void initLlConfig() throws Exception {
        LlConfig.apiUrl = apiUrl;
        LlConfig.platform = platform;
        LlConfig.pgwUrl = pgwUrl;
        LlConfig.fileUrl = fileUrl;
        LlConfig.llPublicKey = llPublicKey;
        LlConfig.publicKey = publicKey;
        LlConfig.privateKey = privateKey;
        LlConfig.merchantNo = merchantNo;
        LlConfig.openAccountNotifyUrl = openAccountNotifyUrl;
        LlConfig.openAccountReturnUrl = openAccountReturnUrl;
        LlConfig.modifyUserNotifyUrl = modifyUserNotifyUrl;
        LlConfig.anonymousBindCardNotify = anonymousBindCardNotify;
        LlConfig.bindCardNotify = anonymousBindCardNotify;
        LlConfig.paySuccessNotifyUrl = paySuccessNotifyUrl;
        LlConfig.withdrawNotify = withdrawNotify;
        LlConfig.daoWithdrawNotify = daoWithdrawNotify;
        LlConfig.unAnonymousBindCardNotify = unAnonymousBindCardNotify;
        LlConfig.paySuccessReturnUrl = paySuccessReturnUrl;
        LlConfig.unBindCardNotify = unBindCardNotify;
        LlConfig.mallLlNotifyUrl = mallLlNotifyUrl;
        LlConfig.mallLlRefundNotifyUrl = mallLlRefundNotifyUrl;
        LlConfig.businessOpenAccountNotifyUrl = businessOpenAccountNotifyUrl;
    }
}
